package main

func main() {
	//创建一个默认的路由器
	r := gin.Default()

	r.GET("/ping", func(c *gin.Context) {

		c.JSON(200, gin.H{

			"message": "pong",
		})

	})

	r.Run() // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")

}

/* func sayHello(w http.ResponseWriter, r *http.Request) {
	b, _ := ioutil.ReadFile("./hello.html")
	_, _ = fmt.Fprintln(w, string(b))
}

func main() {
	http.HandleFunc("/hello", sayHello)
	err := http.ListenAndServe(":9090", nil)
	if err != nil {
		fmt.Printf("http server faied,err:%v\n", err)
		return
	}
} */
